<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <title>能耗管理系统</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="../../resources/lib/bui/css/dpl-min.css"
          th:href="@{/resources/lib/bui/css/dpl-min.css}"
          rel="stylesheet" type="text/css" />
    <link href="../../resources/lib/bui/css/bui-min.css"
          th:href="@{/resources/lib/bui/css/bui-min.css}"
          rel="stylesheet" type="text/css" />
    <link href="../../resources/lib/bui/css/main-min.css"
          th:href="@{/resources/lib/bui/css/main-min.css}"
          rel="stylesheet" type="text/css" />
    <link href="../../resources/accordion/accordion.css"
          th:href="@{/resources/accordion/accordion.css}"
          rel="stylesheet" type="text/css" />

</head>
 <body style="background-image: url('../../../resources/nh/images/login.png')">
  <div style="height: 120px;" id="topDiv">
      <div class="dl-title">
          <div id="titleDiv" style="position:absolute; left: 1%;width:430px;height:50px; margin-top:30px;">
           </div>
      </div>
    <div class="dl-log">
        <!--欢迎您，<span class="dl-log-user" th:text="${currentUser.username}">admin</span>-->
        <a href="#" onclick="usersOpen()" title="用户管理" class="dl-log-quit" th:if="${system}">
            <img style="width: 60px;height: 60px;"
                 src="../../../resources/nh/images/user.png" />[用户管理]</a>
        <a href="#" onclick="settingOpen()" title="系统设置" class="dl-log-quit" th:if="${system}">
            <img style="width: 60px;height: 60px;"
                 src="../../../resources/nh/images/setting.png" />[系统设置]</a>
        <a href="#" onclick="changePassword()"  title="修改密码" class="dl-log-quit" th:if="!${system}">
            <img style="width: 60px;height: 60px;"
                 src="../../../resources/nh/images/user.png" />[修改密码]</a>
        <a href="/logout" th:href="@{/logout}" title="退出系统" class="dl-log-quit">
            <img style="width: 60px;height: 60px;"
                 src="../../../resources/nh/images/exit.png" />[退出]</a>
        <!--<a href="#" title="帮助" class="dl-log-quit">帮助</a>-->
    </div>
  </div>
   <div class="content">
    <div class="dl-main-nav" style="height: 20px">

    </div>
    <ul id="J_NavContent" class="dl-tab-conten">
    </ul>
   </div>
  <script type="text/javascript" src="../../resources/lib/bui/js/jquery-1.8.1.min.js"
          th:src="@{/resources/lib/bui/js/jquery-1.8.1.min.js}"></script>
  <script type="text/javascript" src="../../resources/lib/bui/js/bui-min.js"
          th:src="@{/resources/lib/bui/js/bui-min.js}"></script>
  <script type="text/javascript" src="../../resources/lib/bui/js/config.js"
          th:src="@{/resources/lib/bui/js/config.js}"></script>
  <script type="text/javascript" src="../../resources/lib/bui/js/common/main.js"
          th:src="@{/resources/lib/bui/js/common/main.js}"></script>
  <script th:inline="javascript" type="text/javascript">
      var BASE_URL = /*[[@{/admin/}]]*/ 'admin/';

      var system = /*[[${system}]]*/true;
      var nodeList = /*[[${nodeList}]]*/[];
      var pic1 = /*[[${pic1}]]*/ '/';
      var pic2 = /*[[${pic2}]]*/ '/';

      $("body").css("background-image","url("+pic1+")");
      $("body").css("background-repeat","no-repeat");
      $("body").css("background-size", "100% 100%");


      $("#titleDiv").css("background-image","url("+pic2+")");
      $("#titleDiv").css("background-repeat","no-repeat");
      $("#titleDiv").css("background-size", "100%");

//      document.getElementById("titleDiv").style.backgroundImage='url('+pic2+')';
//      document.getElementById("titleDiv").style.backgroundRepeat = 'no-repeat'
//      document.getElementById("titleDiv").style.backgroundSize = '100% 100%';

      function usersOpen(){
          window.open ('nh/system/users.html', '用户管理', 'height=400, width=850, top=200, left=400, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no');
      }

      function settingOpen(){
          window.open ('nh/system/setting.html', '系统设置', 'height=600, width=1000, top=200, left=400, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no');
      }

      function changePassword(){
          window.open ('nh/system/changePassword.html', '修改密码', 'height=220, width=300, top=200, left=400, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no');
      }

      $(function(){
          if(system){
              BUI.use('common/main',function(){
                  var config = [];
                  var item = [];
//                  item.push({id:'1',text:'首页'});
                  item.push({id:'2',text:'菜单设置'});
                  config.push({
                      id:'camera',
                      baseUrl:'nh/system/treeMenuSetting.html',
                      menu: item,
                      isShowAdd:false,
                      isShowTpl:false
                  });

                  new PageUtil.MainPage({
                      modulesConfig : config
                  });
              });
          }else{
              var sideMenuItems;
              BUI.use('common/main',function(){
                  var config = [];
                  config.push({
                      id:'camera',
                      homePage : 'nh/system/homePage.html',

                      baseUrl:'nh/template/template_setting?modelCount=0&nodeId=',
                      menu:nodeList,
                      isShowAdd:false,
                      isShowTpl:false
                  });
                  new PageUtil.MainPage({
                      modulesConfig : config
                  });
              });

              console.log(nodeList)

              top.topManager.openPage({
                  id : 1,
                  href : "nh/system/homePage.html",
                  title : "首页",
                  closeable : false
              });
//              BUI.use(['bui/data'],function(Data){
//                  var Ajax  = Data.Proxy.Ajax;
//                  var ajax = new Ajax({
//                      url : /*[[@{/nh/system/treeMenu/getSideEnumNode/}]]*/'/'
//                  })
//                  ajax.read(
//                          {},
//                          function(data){
//                              console.log(JSON.stringify(data))
//                              sideMenuItems= data;
//
//                              BUI.use('common/main',function(){
//                                  var config = [];
//                              config.push({
//                                  id:'system',
//                                  //homePage : '1',
//                                  menu:sideMenuItems,
//                                  isShowAdd:false,
//                                  isShowTpl:false,
//                                  baseUrl:"http://www.sina.com.cn",
//                                  speed: 220
//                              });
//                              var mainPage = new PageUtil.MainPage({
//                                  modulesConfig : config
//                              });
//
//                                  config.push({
//                                      id:'camera',
//                                      //homePage : '1',
//                                      baseUrl:'nh/system/treeMenuSetting.html',
//                                      menu:nodeList
//                                  });
//                                  new PageUtil.MainPage({
//                                      modulesConfig : config
//                                  });
//
//                              console.log(mainPage);
//
//                                  //删除选中的菜单节点
//                                  $("#btnDelTreeItem").click(function(){
//
//                                      $.ajax({
//                                          url: /*[[@{/admin/access/timezone/insetTimezoneGroup/}]]*/'/',
//                                          type:'POST',
//                                          data:{},
//                                          //beforeSend:function(){在发送请求之前你要做的事},
//                                          //afterSend:function(){在发送请求后你想做的事},
//                                          success:function(result){  } ,
//                                          error:function(){alert('失败了！')}
//                                      });
//                                      BUI.Message.Alert('删除成功！',function(){},'info');
//                                  });
//
//                                  //保存菜单节点
//                                  $("#btnSaveTreeItem").click(function(){
//
//                                      $.ajax({
//                                          url: /*[[@{/admin/access/timezone/insetTimezoneGroup/}]]*/'/',
//                                          type:'POST',
//                                          data:{},
//                                          //beforeSend:function(){在发送请求之前你要做的事},
//                                          //afterSend:function(){在发送请求后你想做的事},
//                                          success:function(result){  } ,
//                                          error:function(){alert('失败了！')}
//                                      });
//                                      BUI.Message.Alert('保存成功！',function(){},'info');
//                                  });
//                              });
//
//                          },
//                          this
//                  );
//              });
          }
      });


  </script>
 </body>
</html>

